# Maintainer: David Runge <dvzrv@archlinux.org>
# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

_name=starlette
pkgname=python-$_name
pkgver=0.26.1
pkgrel=2
pkgdesc='The little ASGI framework that shines'
arch=(any)
url="https://github.com/encode/starlette"
license=(BSD)
depends=(python python-anyio python-typing-extensions)
makedepends=(python-build python-installer python-hatchling python-wheel)
checkdepends=(
  python-aiosqlite
  python-databases
  python-pytest
  python-trio

  # optdepends
  python-itsdangerous
  python-jinja
  python-python-multipart
  python-pyyaml
  python-httpx

  # not specified,but required
  python-sqlalchemy
)
optdepends=(
  'python-itsdangerous: for session middleware support'
  'python-jinja: for jinja templates'
  'python-python-multipart: for form parsing'
  'python-pyyaml: for schema generator'
  'python-httpx: for test client'
)
source=($_name-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz)
sha512sums=('2974b778481f6a701e8697a7a48dad33cbb8569acc5e3bf123769c3f6380d6aa5730aff3e1ba4978eee025d2479e11c731b669e58e08e16f6870225ed813d42b')
b2sums=('bfaef7cf0826cbb4ec133e47ae918a1021fd2fe1e7048651f72f6fdcba49a80ec53bff1d63cfa56cf9e075ea58f62db0a5fab4ccfd80463a69f79e26eabc8c03')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  pytest -vv -o 'markers=filterwarnings' -p no:warnings
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 LICENSE.md -t "$pkgdir/usr/share/licenses/$pkgname/"
}
